let
$nl := '&#10;' return
let
$espacio := '&#32;' return
let
$municipio:= 247 return
let
$ways := for $var in /osm/way where $var/tag[@k='name']
return $var
return for $way in $ways return
for $latLon in /osm/node [@id= data($way/nd[count($way/nd)idiv 2]/@ref)]
return
data(<query> {$nl} {$nl} INSERT INTO `oehr_dev`.`lugar` (id,padre_id, nombre, tipolugar, coordenadas, version) VALUES ({data($way/@id)},{data($municipio)},'{data($way/tag[@k='name']/@v)}', 'Calle',GEOMFROMTEXT('POINT({data($latLon/@lat)}{$espacio}{data($latLon/@lon)})',####),0) on duplicate key update id=id, padre_id=padre_id;</query>)